﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCoreDemo
{
    public interface IUserService
    {
        Task<IList<User>> GetUserListAsync();
    }

    public class UserService : IUserService
    {
        private readonly IUserRepository _userRepository;
        public UserService(IUserRepository userRepository)
        {
            _userRepository = userRepository;
        }

        public async Task<IList<User>> GetUserListAsync()
        {
            var list = await  _userRepository.Take(5).ToListAsync();

            //await _userRepository.DeleteAsync(list[0]);
            //await _userRepository.DeleteAsync(m => m.Id == 7471039);

            return list;
        }
    }
}
